<include file="__THEME__/header" />
<script type="text/javascript" src="../Public/Js/addBlog.js"></script>
<link rel="stylesheet" href="../Public/blog.css" type="text/css" media="screen" charset="utf-8" />

<div class="content"><!-- 内容 begin  -->
    <include file="__THEME__/apps" />
    <div class="main"><!-- 画布 begin  -->
        <div class=page_title> <!-- page_title begin -->
            <h2><img src="../Public/images/ico_app01.gif" />编辑日志</h2>
            <div class="c"></div>
        </div><!-- page_title end -->



        <div class="BlogBox">

            <form action="{$link}" method="post" onsubmit="return check()">
                <div class="sidebar" style="margin-top:52px;"><div class="lh20">添加在日记中提到的好友</div>                    <!-- 添加好友-->
                    {:W("SelectFriend")}

                    <script type="text/javascript" charset="utf-8">
                        var outline = '{$saveId}';
                        var friendId = new Array();
                        var friend_name = new Array();
                        var friend = JSON.parse('{$mention}');
                        var result="";
                        $( document ).ready( function(){
                            /*
                        KE.show({
                           id : 'content',
                            cssPath : PUBLIC+'/js/kindeditor-3.2/index.css',
                                    emoticons: {$smileList},
                                    emoticonsPath:"{$smilePath}",
                        items: ['fontname','fontsize','textcolor','bgcolor','bold','italic','underline','justifyfull','justifyright','justifyleft','justifycenter','link','image','flash','media','emoticons','source','preview']
                        });
                             */

                            if( outline != '' ){
                                var time = 3*60*1000;
                                var t = setInterval( 'autosave()',time );
                            }

                            $( '#privacy option[value={$private}]' ).attr( 'selected',true );
                            $( '#cc option[value={$canableComment}]' ).attr('selected',true);
                            $( "#select option[value={$category['id']}]" ).attr( 'selected',true );

                            if($('.attach').html()){
                                var temp = $('.attach').clone();
                                                                $('.attach').remove();
                                                                $('#attach_upload_data').append(temp.html());

                            }


                        });
                        for( one in friend ){
                            friendId[one] = friend[one].uid;
                            result += parseImage( friend[one] );
                        }
                        $(".ui-fs-result").append( result );
                        var value=friendId.join( ',' );
                        $( '#ui_fri_ids' ).val( value );
                        function parseImage( vo ){
                            var result = "<a href='javascript:void(0)' name='" + vo.uid + "'><img width='20' height='20' src='" + vo.face + "' title='" + vo.uid + "' alt='' />" + vo.name + "<span title='移除该好友'>移除该好友</span></a>";
                            return result;
                        }


                    </script>
                </div>

                <div class="LogList"><!-- 好友日志 begin  -->
                    <ul class="edit">
                        <li style="padding:0;">
                            <div class="c1">标题：</div>
                            <div class="c2"><select name="category" class="TextH20 mr5" id="select" onchange="javascript:changeCategory($(this))">
                                    <php>foreach( $category_list as $value ){</php>
                                    <option value="{$value['id']}">{$value['name']}</option>
                                    <php>}</php>
                                    <optgroup id="group">
                                        <option value="0">+添加分类</option>
                                    </optgroup>
                                </select>
                                <input id="title" name="title" type="text" class="TextH20" style="width:60%; onBlur="this.className='TextH20'" onFocus="this.className='Text2'" value="{$title}"/>
                            </div>
                        </li>
                        <li style="padding:0;">
                            <div class="c1">内容：</div>
                            <div class="c2">
                            {:W("Edit",array('smileList'=>$smileList,'smilePath'=>$smilePath,'content'=>$content))}
                        
                             <!-- 
                                <iframe id="Editor" name="Editor" src="__PUBLIC__/js/Editor/editor.html?id=content&amp;height=400&width=100" frameborder="0" marginheight="0" marginwidth="0" scrolling="No" style="width: 100%; height: 400px;"></iframe>
                             -->
                            </div>
                        </li>
                        <li style="padding:0;">
                            <div class="c1">权限：</div>
                            <div class="c2" style="height:25px;">
                                <select id="privacy" name="privacy" onchange="javascript:changePrivacy($(this));">
                                    <option value="0">任何人可见</option>
                                    <option value="1">仅好友可见</option>
                                    <option value="2">私密日记</option>
                                    <option value="3">凭密码访问</option>
                                </select>
                                <input id="password" name="password" type="password" style="display:none" />
                            </div>
                        </li>

                        <li style="padding:0;">
                            <div class="c1">评论权限：</div>
                            <div class="c2" style="height:25px;">
                                <select id="cc" name="cc">
                                    <option value="1" selected>任何人可评论</option>
                                    <option value="2">好友可评论</option>
                                    <option value="3">关闭评论</option>
                                </select>
                            </div>
                        </li>

                        <php>if( !empty( $saveId ) ){</php>
                        <li style="padding:0;">
                            <div class="c1"></div>
                        </li>
                        <php>}</php>
                        <li style="padding:0;">
                            <div class="c1">
                                附件：
                            </div>
                            <div class="c2" style="height:25px;">
				{:W( 'UploadAttach',array( 'uid'=>$mid , 'type'=>'blog' , 'callback'=>'attach_upload_success') )}

                            </div>

                        </li>
                          <neq name ="attach" value="">
                            <div class ="attach" style="display:none;">
                                <volist name ="attach" id="vo"></volist>
                                <input class="attach{$vo['id']}" type="hidden" name="attach[]" value="{$vo['id']}|{$vo['name']}"><p>
                                    <span class="attach{$vo['id']}"> [附件] {$vo['name']}</span>
                                    <span class="attach{$vo['id']}"><a class="attach{$vo['id']}" href="javascript:void(0)" onclick="deleteAttach({$vo['id']})">删除</a></span></p>
                                </volist>
                            </div>
                        </neq>
                        <li style="padding:0;">
                            <div class="c1">&nbsp;</div>
                            <div class="c2" style="height:30px;">


                                <input id="id" name="id" type="hidden" value="{$id}">
                                <input id="friendid" name="mention" type="hidden" value="">
                                <input type="submit" class="btn_b" value="发 表" />
                                <php>if( !empty( $saveId ) ){</php>
                                <input id="saveButton" type="button" onclick="javascript:autosave()"class="btn_b" value="存至草稿箱"/> <span id="autoSave" style="display:none;"></span>
                                <input id="saveId" name="saveId" type="hidden" value="{$saveId}"/>
                                <php>}else{</php>
                                <input id="saveButton" type="button" onclick="javascript:history.back(-1)"class="btn_w" value="取消"/>
                                <php>}</php>
                            </div>
                        </li>
                    </ul>
                </div>
            </form>
            <!-- 好友日志 end  -->
        </div>
    </div><!-- 画布 end  -->
    <div class="c"></div>
</div><!-- 内容 end -->
<include file="__THEME__/footer" />
